package cn.edu.neusoft.wuguangsheng.flowerimpression.activity;

import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import cn.edu.neusoft.wuguangsheng.flowerimpression.R;
import cn.edu.neusoft.wuguangsheng.flowerimpression.adapter.BaiKeTuKuAdapter;
import cn.edu.neusoft.wuguangsheng.flowerimpression.adapter.EmptyRecyclerView;
import cn.edu.neusoft.wuguangsheng.flowerimpression.bean.BaiKePhotoBean;
import cn.edu.neusoft.wuguangsheng.flowerimpression.listener.ListListener;
import cn.edu.neusoft.wuguangsheng.flowerimpression.model.GetBaiKeTuKuListModel;

public class BaiKeInfoPhotoListActivity extends BaseActivity {
    ImageView baike_photo_fh;
    TextView tv_message;
    private String enc_id;

    EmptyRecyclerView baike_photo_rv;
    View baike_photo_ev;
    private List<BaiKePhotoBean> items;
    @Override
    void initView() {
        setLayout_file(R.layout.activity_bai_ke_info_photo_list);
        baike_photo_fh = (ImageView)findViewById(R.id.baike_photo_fh);
        tv_message = (TextView)findViewById(R.id.tv_message);
        baike_photo_rv = (EmptyRecyclerView) findViewById(R.id.baike_photo_rv);
        baike_photo_ev = (View)findViewById(R.id.baike_photo_ev);
        enc_id = getIntent().getStringExtra("enc_id");
       // Toast.makeText(BaiKeInfoPhotoListActivity.this,enc_id,Toast.LENGTH_SHORT).show();
        tv_message.setText("这个管理员真懒惰，还没有起床添加图库呢！");

        GetBaiKeTuKuListModel getBaiKeTuKuListModel = new GetBaiKeTuKuListModel();
        getBaiKeTuKuListModel.getBaiKeTuKuList(enc_id, new ListListener<BaiKePhotoBean>() {
            @Override
            public void onResponse(List<BaiKePhotoBean> list) {
                StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
                baike_photo_rv.setLayoutManager(layoutManager );
                items=list;
                BaiKeTuKuAdapter baiKeTuKuAdapter=new BaiKeTuKuAdapter(BaiKeInfoPhotoListActivity.this,items,R.layout.meitu_item);
                baike_photo_rv.setAdapter(baiKeTuKuAdapter);
                baike_photo_rv.setItemAnimator(new DefaultItemAnimator());
                baike_photo_rv.setEmptyView(baike_photo_ev);

            }

            @Override
            public void onFail(String msg) {

            }
        });


    }

    @Override
    void initEvent() {
        baike_photo_fh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    @Override
    void initDate() {

    }
}
